package com.car.commons.web.exception;

import com.car.commons.core.model.WoniuException;
import com.car.commons.core.model.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GloableExceptionHandler {


    @ExceptionHandler(Throwable.class)
    public Result ExceptionHandler(Throwable e) {
        e.printStackTrace();
        return Result.getResult().setCode(500).setMsg("发生异常");
    }


    @ExceptionHandler(WoniuException.class)
    public Result myExceptionHandler(WoniuException e) {
        e.printStackTrace();
        return Result.getResult().setCode(e.getCode()).setMsg(e.getMessage());
    }



}
